﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using F2S.LINQ2LinkedIn.Model;

namespace F2S.LINQ2LinkedIn.Model
{
    [DebuggerDisplay("ID={ID}, FirstName={FirstName}, LastName={LastName}")]
    [XmlRoot("person")]
    [XmlInclude(typeof(SiteStandardProfileRequest))]
    [XmlInclude(typeof(ApiStandardProfileRequest))]
    [XmlInclude(typeof(Location))]
    [XmlInclude(typeof(ConnectionsCollection))]
    public class Person : UpdateItem
    {
        [XmlElement(ElementName = "id")]
        public string ID { get; set; }

        [XmlElement(ElementName = "first-name")]
        public string FirstName { get; set; }
        [XmlElement(ElementName = "last-name")]
        public string LastName { get; set; }
        [XmlElement(ElementName = "headline")]
        public string Headline { get; set; }

        [XmlElement(ElementName = "site-standard-profile-request")]
        public SiteStandardProfileRequest SiteStandardProfileRequest { get; set; }

        [XmlElement(ElementName = "api-standard-profile-request")]
        public ApiStandardProfileRequest ApiStandardProfileRequest { get; set; }

        [XmlElement(ElementName = "location")]
        public Location Location { get; set; }

        [XmlElement(ElementName = "industry")]
        public string Industry { get; set; }

        [XmlElement(ElementName = "picture-url")]
        public string PictureUrl { get; set; }

        [XmlElement(ElementName="connections")]
        public ConnectionsCollection Connections { get; set; }

        [XmlElement("person-activities", IsNullable = true)]
        public PersonActivities PersonActivities { get; set; }

        [XmlElement("skills", IsNullable = true)]
        public SkillsCollection Skills { get; set; }

        [XmlElement("member-groups", IsNullable = true)]
        public MemberGroupsCollection MemberGroups { get; set; }

        [XmlElement("recommendations-received", IsNullable = true)]
        public RecommendationsReceivedCollection RecommendationsReceived { get; set; }

        [XmlElement("current-share", IsNullable = true)]
        public Share CurrentShare { get; set; }

        public override string ToString()
        {
            return string.Format("ID={0}, FirstName={1}, LastName={2}", ID, FirstName, LastName);
        }
    }

    /*
       <person>
        <id>Uj9T8GLPYC</id>
        <first-name>Jason</first-name>
        <last-name>Tupeck</last-name>
        <headline>SAN and Systems Administrator at Washington Corporations</headline>
        <api-standard-profile-request>
          <url>http://api.linkedin.com/v1/people/Uj9T8GLPYC</url>
          <headers total="1">
            <http-header>
              <name>x-li-auth-token</name>
              <value>name:s3QE</value>
            </http-header>
          </headers>
        </api-standard-profile-request>
        <site-standard-profile-request>
          <url>http://www.linkedin.com/profile/view?id=20188052&amp;authType=name&amp;authToken=s3QE&amp;trk=api*a3135321*s3210031*</url>
        </site-standard-profile-request>
        <person-activities count="1">
          <activity>
            <body>&lt;a href=&quot;http://www.linkedin.com/redirect?url=http%3A%2F%2Fwww%2Elinkedin%2Ecom%2Fprofile%2Fview%3Fid%3D20188052%26authType%3Dname%26authToken%3Ds3QE%26trk%3Dapi*a153289*s161564*&amp;amp;urlhash=dK89&quot;&gt;Jason Tupeck&lt;/a&gt; is now using LinkedIn for iPad.  &lt;a href=&quot;http://www.linkedin.com/redirect?url=http%3A%2F%2Fitunes%2Eapple%2Ecom%2Fus%2Fapp%2Flinkedin%2Fid288429040%3Fmt%3D8%26uo%3D4%26trk%3Dnus-iphn&amp;amp;urlhash=gsdw&quot;&gt;Get it now &amp;raquo;&lt;/a&gt;</body>
            <app-id>153289</app-id>
          </activity>
        </person-activities>
      </person>
     * 
     * */
}
